﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdSiShapeImpl : OdSiShape, IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdSiShapeImpl(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdSiShapeImpl obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdSiShapeImpl()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdSiShapeImpl(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		HandleRef OdSiShape.GetCPtr()
		{
			return new HandleRef(this, GlobalsPINVOKE.OdSiShapeImpl_OdSiShape_GetCPtr(this.swigCPtr.Handle));
		}

		public virtual bool contains(OdGeExtents3d extents, bool planar, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdSiShapeImpl_contains(this.swigCPtr, OdGeExtents3d.getCPtr(extents), planar, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool intersects(OdGeExtents3d extents, bool planar, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdSiShapeImpl_intersects(this.swigCPtr, OdGeExtents3d.getCPtr(extents), planar, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdSiShape clone()
		{
			OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.OdSiShapeImpl_clone(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void transform(OdGeMatrix3d arg0)
		{
			GlobalsPINVOKE.OdSiShapeImpl_transform(this.swigCPtr, OdGeMatrix3d.getCPtr(arg0));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static OdSiShape kOverallSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.OdSiShapeImpl_kOverallSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public static OdSiShape kNoSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.OdSiShapeImpl_kNoSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
